home *** CD-ROM | disk | FTP | other *** search
/ Network PC / Network PC.iso / amiga utilities / communication / bbs / hydrabbsa8 / source / src.lha / common / structures.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-08  |  35.5 KB  |  1,004 lines

  1. /*
  2.  
  3.  
  4.   to add
  5.  
  6.   *none*
  7.  
  8. */
  9.  
  10. // right, this is Soooo cool, basically a door calls the MenuPrompt() function
  11. // like this:
  12. // DOOR_MenuPrompt("Fruit [O]ranges, [B]ananas, [A]pples",'B')
  13. // where the B means that Banana's will be selected if the user just
  14. // presses return..
  15. //
  16. // then using the data in BBSCols we can change the output of the prompt
  17. // passed to MenuPrompt() before we display it, here's an example of
  18. // what each setting might be set to..
  19.  
  20.  
  21. struct BBSColsData
  22. {
  23.   V_STRING MenuTextANSI;            // default:     "white"
  24.   V_STRING MenuOpenBracket;         // default: [   "blue + ["
  25.   V_STRING MenuCloseBracket;        // default: ]   "blue + ]"
  26.   V_STRING MenuHighlightANSI;       // default:     "yellow"
  27.   V_STRING MenuDefaultOptANSI;      // default:     "bold + white"
  28.   V_STRING MenuPromptANSI;          // default: :   "blue + :"
  29. };
  30.  
  31. // using the defaults above with the example above, the string that gets
  32. // printed looks like this:
  33. //
  34. // "Fruit [O]ranges, [B]ananas, [A]pples"
  35. //
  36. // as you can see, there is quite alot of scope for cool menu designs!
  37. // and you can have different settings for difference conferences and different nodes too !!
  38.  
  39.  
  40. // when a user joins a conf first copy the correct access settings from
  41. // the list of access settings in BBSGlobal->AcsList (HBBS:Access/Level_XX
  42. // to Node->User.Acs then overwrite this data Using UpdateAcs(dest,new)
  43. // with the settings for the Node->Acs, (NodePath/Access/Level_XX)
  44. // then override these settings with the access settings from
  45. // the conference itself (ConfPath/Access/Level_XX), and finally
  46. // override these settings with the users own access settings.
  47.  
  48.  
  49. struct ConfData
  50.   {
  51.     // conference data is a linked list (see BBSGlobal->ConfList)
  52.     struct Node   node;
  53.  
  54.     // the conference's name is stored in node->ln_Name and loaded from the
  55.     // ConfName in the ConfConfig config file.
  56.     // makes it cool for intuition based utils  (nukers ?)
  57.  
  58.     V_BIGNUM      ConfNum;    // filled in by Control, ranges from 1 to BBSGlobal->Conferences
  59.  
  60.     V_BOOL        ConfActive; // if set then you may use the conference
  61.                               // possible use is for cd-rom conferences, you could write
  62.                               // a door to de-activeate a conference if the cd was taken
  63.                               // out (but make sure there are NO users in that conference
  64.                               // when you modify this value.
  65.     V_SMALLNUM    ConfAccess; // access required to enter conference
  66.  
  67.     // Public : Path to conference (initialised from ConfList and NOT ConfConfig)
  68.     V_STRING      ConfPath;
  69.  
  70.     V_STRING      HoldFileList;   // path and filename of file that holds the list
  71.                               // of privately uploaded files
  72.     V_STRINGLIST  HoldFiles;  // path(s) to above files
  73.  
  74.     V_STRING      BadFileList; // same as hold but for bad/corrupt files
  75.     V_STRINGLIST  BadFiles;
  76.  
  77.     V_STRINGLIST  PartUpload; // path for uploaded files that were not completed
  78.  
  79.     V_STRINGLIST  FileList;   // file listings
  80.  
  81.     V_STRINGLIST  Upload;     // paths for uploaded files to go to..
  82.     V_STRINGLIST  Download;   // paths to download files from
  83.  
  84.     V_SMALLNUM    MaxDIZLines; // max lines for the file description
  85.  
  86.     V_STRING      MenuPrompt;  // prompt for the menu
  87.  
  88.     V_BOOL        AutoMailScan; // automatic mail scan ?
  89.  
  90.     V_STRING      ConfPassWD; // conference password
  91.  
  92.     V_STRINGLIST  UserAllowed; // list of users allowed, or NULL
  93.                                // if you want to allow every user access to the conf
  94.  
  95.     V_BIGNUM      FileLists;   // *C* Move to below FileList,  contains amount of file lists..
  96.  
  97.   };
  98.  
  99.  
  100. // defines all data needed for the device for the node
  101.  
  102. struct DeviceData
  103.   {
  104.     V_BOOL SysopNode; // gets set to  TRUE if the Device file does not
  105.                       // exist in the nodes/nodex/ direcotry..
  106.                       // this determines wether we open the serial port
  107.  
  108.     // following settings are defined in nodex/device
  109.  
  110.     V_STRING DeviceName;  // as in name of modem rather than amiga .device!
  111.     V_STRING SerialDevice; // name/path of .device file..
  112.     V_BIGNUM SerialUnit;
  113.     V_BIGNUM SerialBaud;  // baud rate
  114.     V_BOOL ModemDebug;   // show inout/output to and from modem commands
  115.     V_BOOL ModemLog;  // log all input/output of modem commands
  116.  
  117.     V_SMALLNUM   EchoRetries;
  118.     V_SMALLNUM   ReOpenRetries;
  119.     V_BIGNUM     ReOpenDelay;
  120.     V_STRING     LockUpScript;
  121.  
  122.     V_BIGNUM     MaxCommandWait;
  123.     V_SMALLNUM   CommandRetries;
  124.     V_BIGNUM     DelayBetweenCmds;
  125.     V_BIGNUM     TildeDelay;
  126.  
  127.     V_STRINGLIST TurnOnEcho;
  128.     V_BIGNUM     TurnOnEchoDelay;
  129.  
  130.     V_STRINGLIST ModemInit;
  131.  
  132.     V_BOOL       StrictConnect;
  133.     V_STRINGLIST StrictConnectStr;
  134.     V_STRINGLIST RelaxedConnectStr;
  135.  
  136.     V_STRINGLIST CommandModeString;
  137.     V_BOOL       DropDTRHangup;
  138.     V_STRING     HangUpString;
  139.     V_STRING     OffHookString;
  140.     V_STRING     Incoming;
  141.     V_STRING     ImmediateAnswer;
  142.     V_BOOL       NullModemCable;   // show inout/output to and from modem commands
  143.   };
  144.  
  145. struct NodeSettingsData   // these settings are always in memory, even when
  146.                           // a node is closed (for stuff like lastcallers utils to examine)
  147.   {
  148.     V_STRING   SysopAccount;
  149.     V_STRING   NodeName;
  150.     V_STRING   NodePhone;
  151.     V_STRING   NodeConnectScript;
  152.  
  153.     V_BOOL     AskUserPW;
  154.  
  155.     V_BOOL     UseSysPW;
  156.     V_STRING   SysPW;
  157.     V_STRING   SysPWScript;
  158.     V_STRING   SysPWPrompt;
  159.  
  160.     V_BOOL     UseNodePW;
  161.     V_STRING   NodePW;
  162.     V_STRING   NodePWScript;
  163.     V_STRING   NodePWPrompt;
  164.  
  165.     V_STRING   UserNamePrompt;
  166.     V_STRING   UserPWPrompt;
  167.  
  168.     V_STRING   NodeLogFile;
  169.     V_STRING   ModemLogFile;
  170.     V_STRING   CallersLogFile;
  171.     V_BOOL     UploadLog;
  172.     V_BOOL     DownloadLog;
  173.  
  174.     V_BOOL     ChatFlag;
  175.     V_BOOL     Iconified;
  176.     V_BOOL     UseOwnScreen;
  177.     V_BOOL     StartScreen;
  178.  
  179.     V_BIGNUM   ScrModeID;
  180.     V_BIGNUM   ScrWidth;
  181.     V_BIGNUM   ScrHeight;
  182.     V_BIGNUM   ScrDepth;
  183.  
  184.     V_SMALLNUM AccessRequired;
  185.  
  186.     V_BOOL     UseDevice;
  187.     V_BOOL     AllowNewUsers; // set to true if you want to allow new users to join.
  188.  
  189.     V_STRING   NodePlayPen;
  190.     V_SMALLNUM MaxDIZLines; // default max diz lines.  it gets copied to N_ND->MaxDizLines
  191.  
  192.     // MUCH more to come...
  193.  
  194.     // update stuff in source/common/shared.c
  195.   };
  196.  
  197. // struct for time access data, see BBSGlobal->TimesList for linked list of these...
  198.  
  199.  
  200. struct TimeAccessData
  201.   {
  202.     struct Node node;  // ln_Name contains the filename from which the data
  203.                        // was loaded, so that the filename in the users
  204.                        // user.data is matched to ln_Name to find the right one,
  205.                        // rather than searching/loading it everytime a user logs on..
  206.  
  207.     V_BOOL     Times[7][24];
  208.   };
  209. /*
  210.    times between 1:00am and 12:59pm
  211.         AM          PM
  212.         1         111         11
  213.         212345678901212345678901         a + here means a user can login during that
  214.     Mon +++++++++---------++++++         hour above the +, a - means the user is
  215.  d  Tue +++++++++---------++++++         NOT allowed to login..
  216.  a  Wed +++++++++---------++++++
  217.  y  Thu +++++++++---------++++++         so in this example the user would be able
  218.     Fri +++++++++---------++++++         to login between 12:00am and 8:59am and
  219.     Sat ++++++++++++++++++++++++         between 6:00pm and 11:59pm except on the
  220.     Sun ++++++++++++++++++++++++         weekend where they can login at anytime..
  221.         NIGHT     DAY      NIGHT
  222.                                          cool huh ?
  223. */
  224.  
  225. struct AccessData
  226.   {
  227.     V_SMALLNUM AccessLevel;
  228.     V_CHAR Data[MAX_ACCESSSETTINGS];  // currently 4096, see defines.h and access.h
  229.   };
  230.  
  231. // this is the file format of the userdata.hbbs file... :-) no more hunting
  232. // and hacking to find it out! YEah!!!!
  233.  
  234. // when memory is allocated for the userdata it should be MEMF_CLEAR'd
  235. // so that when it is written to the end or back to the userdata.hbbs
  236. // file it does not contain any garbage characters that would appear otherwise..
  237.  
  238. struct UserData
  239.   {
  240.     // note: users DON'T have any form of ID based upon position in the file
  241.     // but they do have ID, which is thier unique number that will always
  242.     // be the same even if the userdata file is tieded.
  243.  
  244.  
  245.  
  246.     V_BIGNUM   UserID;   // When a user joins the system they are given
  247.                          // a number, this number is BBSGlobal->LastUserNum+1
  248.                          // this number is garunteed to be unique
  249.                          // as this number goes up one everytime a new user
  250.                          // is added to the user data file, but never goes down
  251.                          // when users are removed.
  252.                          // The lastusernum itself is stored in
  253.                          // HBBS:System/Data/Private
  254.  
  255.     // see the flags USER_#? defined in <hbbs/defines.h>
  256.  
  257.     V_CHAR     Status;   // 'N' for new user      - the user is a new user..
  258.                          // 'V' for validated     - the sysop has validated the user
  259.                          // 'D' for deleted       - the sysop deleted the account
  260.                          // 'I' for inactive      - the account became inactive
  261.                          // 'L' for logins denied - user is not allowed to login.
  262.                          // 'O' for overwritable  - set if you want this account to
  263.                          //                         be erased by new accounts
  264.  
  265.     V_SMALLNUM Access;   // defines the users access level..
  266.  
  267.     // all arrays of V_CHAR are +1 for null terminator and should be allocated
  268.     // with a MEMF_CLEAR flag...
  269.  
  270.     V_CHAR     Handle[LEN_HANDLE+1];          // all obvious definitions..
  271.     V_CHAR     RealName[LEN_REALNAME+1];
  272.     V_CHAR     Group[LEN_GROUP+1];
  273.     V_CHAR     GeoLocation[LEN_GEOLOCATION+1];
  274.     V_CHAR     Country[LEN_COUNTRY+1];
  275.     V_CHAR     PhoneNumber[LEN_PHONENUMBER+1];
  276.     V_CHAR     Password[LEN_PASSWORD+1];    // not encrypted.. as if i did
  277.                                 // encrypt it some bugger would write a
  278.                                 // password hacker anyway!
  279.     V_CHAR     ComputerType[LEN_COMPUTERTYPE+1];  // note: this is a string, not a number!
  280.  
  281.  
  282.     V_CHAR     ConfAccDataFile[LEN_CONFACCESSFILE+1];  // filename pointer to data for the access to
  283.                                                        // conferences, e.g. "NewUser"
  284.                // we look in HBBS:System/Data/ConfAcs for the above filename
  285.  
  286.                // note: this might be blank, if so the confjoiner program must check the access
  287.                // level of the conference the user wants to join.
  288.  
  289.                // this file is normally only used to disable/enable access to conferences
  290.                // without changing their access levels (which would enable more ACS_ commands)
  291.  
  292.  
  293.     V_CHAR     LeechAccDataFile[LEN_LEECHACCESSFILE+1];
  294.                // we look in HBBS:System/Data/LeechAcs for the above filename
  295.  
  296.     // below are the values the nukers should play with and all the doors
  297.     // should actually use to figure out stuff like weektops/conf tops/charts...
  298.  
  299.     // these are also used to work out the ratios and wether the user is over the
  300.     // limit or not..
  301.  
  302.     V_BIGNUM   UploadBytes;
  303.     V_BIGNUM   UploadFiles;
  304.     V_BIGNUM   DownloadBytes;
  305.     V_BIGNUM   DownloadFiles;
  306.  
  307.     // these numbers below are the ACTUAL ammount of bytes the user has transferred
  308.     // (via file transfer protocols like Zmodem) no doors should EVER change the
  309.     // values in these variables, treat them as is they were readonly..
  310.  
  311.     // they should be used for programs that work out the amount of bytes that
  312.     // have been uploaded to the system in a year, how many bytes have been nuked
  313.     // etc etc...
  314.  
  315.     V_BIGNUM   ActualUploadBytes;
  316.     V_BIGNUM   ActualUploadFiles;
  317.     V_BIGNUM   ActualDownloadBytes;
  318.     V_BIGNUM   ActualDownloadFiles;
  319.  
  320.     // dates for last upload and when the user last called.. great for spotting
  321.     // users who have uploaded loads and then turned into a leech!
  322.     // also so that doors can work out how many days since user last uploaded
  323.     // great for creating lists of lamers..
  324.  
  325.     // you could write a door that tells the user their account will expire in N
  326.     // days if they do not upload! cooool!
  327.  
  328.     LONG       LastUploadDate;
  329.     LONG       LastCalledDate; // use time() and localtime() on these..
  330.  
  331.     // some vars for bulletin/top chart makers! :-) hope this helps!
  332.  
  333.     V_BIGNUM   BestCPSUp;
  334.     V_BIGNUM   BestCPSDown;
  335.     V_BIGNUM   CallsMade;
  336.     V_BIGNUM   PagesMade;
  337.     V_BIGNUM   MessagesWritten;
  338.  
  339.  
  340.     V_SMALLNUM BytesRatio;   // as in N:1...
  341.     V_SMALLNUM FilesRatio;
  342.  
  343.     V_BIGNUM   LastConf;  // last conf user was in when they logged off..
  344.     V_BIGNUM   PreferedConf; // users prefered conference, if this is not set to 0
  345.                              // then join this conference instead of the conference
  346.                              // the user was last in...
  347.                              // conference joiner must check that this is a valid conf
  348.                              // numer and that the user has access to it before
  349.                              // joining it upon login.
  350.  
  351.     V_SMALLNUM LinesPerScreen; // obvious!
  352.  
  353.     V_SMALLNUM Protocol;    // number of protocol to use, if set to 0 then
  354.                             // the the bbs will ask the user what
  355.                             // protocol the user wishes to use for EVERY transfer
  356.  
  357.     V_SMALLNUM Editor;      // same as above except for editing text files...
  358.  
  359.     V_SMALLNUM ScreenType;  // use for enabling/disabling ansi colour..
  360.  
  361.     V_CHAR     TimeAccessFile[LEN_TIMEACCESS+1];
  362.                             // number of TimeAccess to use.. (defines when a user
  363.                             // can and can't login..
  364.                             // looks in HBBS:System/Data/TimeAcs for this file..
  365.  
  366.                             // note: match THIS name to the name in the BBSGlobal->TimeAcsList
  367.                             // nodes's ln_Name field rahter than loading each time as all access
  368.                             // data is loaded at control startup time.
  369.  
  370.     V_BIGNUM   ExtraTimeLimit;
  371.                             // if this is set then this number will be added to the
  372.                             // amount of time a user is allowed on-line
  373.                             // which is defined for each access level..
  374.  
  375.     V_BIGNUM   ExtraBytesLimit;
  376.                             // this number is added to the amount of bytes the user
  377.                             // is allowed to download in one day which is defined
  378.                             // for each access level...
  379.  
  380.     V_BIGNUM   ExtraCallsLimit;
  381.                             // same as above except for calls a user is allowed to
  382.                             // make in one day
  383.     V_BIGNUM   ExtraChatLimit;
  384.                             // same as above except for chat time user allowed to
  385.                             // have per day
  386.  
  387.     V_BIGNUM   BytesAllowed;
  388.                             // amount of bytes user is allowed to download in one day.
  389.  
  390.     V_BIGNUM   TimeAllowed;
  391.                             // amount of time user is allowed in one day.
  392.  
  393.     V_BIGNUM   ChatAllowed;
  394.                             // amount of chat time user is allowed in one day.
  395.  
  396.     V_BIGNUM   CallsAllowed;
  397.                             // amount of calls a user is allowed to make in one day.
  398.  
  399.  
  400.     V_BIGNUM   TimeUsed;
  401.                             // total amount of time used today..
  402.                             // (so, to determine when to log off a user get the amount
  403.                             // of time a user is allowed per day from the access settings
  404.                             // for that level, then add the ExtraTimeLimit to that, then
  405.                             // take off the TimeUsed value and if it's <= 0 then log em off!
  406.  
  407.                             // The BBS Resets this value at 00:00am to 0 when the user is
  408.                             // online, the frontend must check the last called date with
  409.                             // todays date to determine wether or not to reset this
  410.                             // at logon time..
  411.  
  412.     V_BIGNUM   BytesUsed;
  413.                             // amount of bytes downloaded today. see timeused also.
  414.  
  415.     V_BIGNUM   CallsUsed;
  416.                             // amount of calls made today. see timeused also.
  417.  
  418.     V_BIGNUM   ChatUsed;
  419.                             // amount of chat time used today. see timeused also.
  420.  
  421.     V_CHAR     UserType;    // currently set to either
  422.                             // USERTYPE_NORMAL or USERTYPE_EXPERT
  423.                             // this is used by the CmdPrompt door to
  424.                             // decide wether or not to display the menu options
  425.                             // availiable to the user.  can also be used by
  426.                             // other programs
  427.  
  428.     V_BIGNUM   Language;    // Number of LanguageName/Extn to be used. (index starts at 1)
  429.  
  430.   }; // don't forget to update HBBSCommon.c/HBBS_InitUserData()
  431.  
  432. // conference flags for reading mail and scanning files are NOT in the user data
  433. // as this is upto the mail/file system to handle...
  434.  
  435.  
  436. struct NodeUser
  437.   {
  438.     BOOL Valid;  // if there is no user on-line then this will be FALSE
  439.                  // it is critical that all doors check this before accessing
  440.                  // any more data contained within this sructure.
  441.  
  442.     struct UserData NormalData;  // the user.data is loaded here first
  443.     struct UserData CallData;    // then copied to here. and THIS is the data
  444.                                  // most of your doors/programs should use
  445.                                  // to determine access and stuff as the sysop
  446.                                  // might want to override the access level
  447.                                  // settings for the call..
  448.  
  449.     struct TimeAccess *TimeAcs;  // only points to a TimeAccessData already loaded.
  450.     struct AccessData Acs;       // current access settings (dependant on
  451.                                  // Conference,Node and normal in that order..
  452.   };
  453.  
  454. // we send this message between the node and control to ask for pointers
  455. // set the Flags variable to and of the HBBS_AMF_#? flags defines in
  456. // common/defines.h
  457.  
  458. // *C* used ?
  459.  
  460. struct AskMsg
  461.   {
  462.     struct Message message;
  463.     ULONG MsgType; // see nodemsg below..
  464.     V_BIGNUM NodeNum; //see nodemsg below
  465.     ULONG Flags;
  466.     void *Pointer;
  467.     ULONG Value;
  468.   };
  469.  
  470. // sent between from a node to the control program
  471.  
  472. struct StatusMsg
  473.   {
  474.     struct Message message;
  475.     ULONG MsgType; // see nodemsg below..
  476.     V_BIGNUM NodeNum; //see nodemsg below
  477.     V_BIGNUM Status;
  478.   };
  479.  
  480. struct RequestMsg     // Message sent FROM a node to the control program
  481.   {
  482.     struct Message message;
  483.     ULONG MsgType; // see nodemsg below..
  484.     V_BIGNUM NodeNum; //see nodemsg below
  485.     ULONG Flags;
  486.   };
  487.  
  488. // used for communicating between a door and a node..
  489.  
  490. struct DoorIOMsg
  491.   {
  492.     struct Message message;
  493.     ULONG MsgType;
  494.     V_BIGNUM NodeNum;
  495.     ULONG Status;
  496.     UBYTE *Data; // null terminated string or data
  497.     ULONG DataLength; // length of data (above) in bytes
  498.     ULONG Flags;
  499.     ULONG ReturnVal;
  500.     UBYTE *OptionStr; // for sting options such as parameters for doors..
  501.     ULONG Num1;
  502.     ULONG Num2;
  503.   };
  504.  
  505. // tells the node when a door has started and when one has stopped.
  506.  
  507. struct DoorActivityMsg
  508.   {
  509.     struct Message message;
  510.     ULONG MsgType;
  511.     V_BIGNUM NodeNum;
  512.     ULONG Status;
  513.   };
  514.  
  515. // all messages sent to a CONTROL/NODE/DOOR program must contain these variables
  516. // so we know what's happening (and to aid message trace programs)...
  517.  
  518. struct NodeMsg
  519.   {
  520.     struct Message message;
  521.     ULONG MsgType;
  522.     V_BIGNUM NodeNum; // these three fields are contained in all the message structures that are passed
  523.                       // between the node and the control program, then depending on the TYPE field (see defines.h)
  524.   };                  // they are typecasted onto a different structure and passed to the correct subroutine to deal
  525.                       // with the message, for this reason these 3 fields MUST be present in any other messagetype
  526.                       // for the node program to deal them correctly (system MAY hang if you send a buggered msg...)
  527.  
  528. struct DoorData
  529.   {
  530.     struct Node node;
  531.     struct MsgPort *DoorPort;
  532.     struct MsgPort *ReplyPort;
  533.     UBYTE DoorPortName[20];
  534.     UBYTE *SystemOptions;
  535.   };
  536.  
  537. struct TimerData
  538.   {
  539.     struct Node node;
  540.     struct timerequest TR;
  541.   };
  542.  
  543. struct TimerSetupData
  544.   {
  545.     struct MsgPort *TimerPort;
  546.     struct timerequest *BlankTimerIO;
  547.     struct List *TimerList;
  548.     V_BOOL TimerOpen;
  549.  
  550.   };
  551.  
  552.  
  553.  
  554. struct NodeData
  555.   {
  556.     // private:
  557.     struct Node node; // for passing to list and for the ctrlwnd list view..
  558.  
  559.     // public:
  560.     V_BIGNUM Status;
  561.     V_SMALLNUM NodeNum;
  562.  
  563.     // private:
  564.     V_BOOL AutoStart;
  565.  
  566.     // private:
  567.     char PortName[15]; // port name for node, used to ask the node program stuff
  568.                        // by doors..
  569.  
  570.     // private:
  571.     char DoorStartPortName[25];
  572.  
  573.     // private:
  574.     struct MsgPort *NodePort,  // ports used to send messages to the CONTROL program
  575.                    *ReplyPort,
  576.  
  577.                    *ConRPort,  // used by the console window for the node..
  578.                    *ConWPort,
  579.  
  580.                    *SerPort; // only one port for serial device needed...
  581.  
  582.     // private:
  583.     struct IOStdReq *ConRead,  // io requests for console window
  584.                     *ConWrite;
  585.  
  586.     // private:
  587.     struct IOExtSer *SerRead,  // io requests for serial port
  588.                     *SerWrite;
  589.  
  590.     // private:
  591.     struct TimerSetupData *NodeTimer; // timer io data for the node..
  592.  
  593.     // private:
  594.     struct Screen *ConScr;  // screen for watching a user..
  595.                             // note: this might be set to the same screen
  596.                             // as CtrlScr.. or even workbench screen :-)
  597.     // private:
  598.     struct Window *ConWin;  // window for above! :-)
  599.     // private:
  600.     struct Window *NodeWnd;
  601.     struct Window *InfoWnd;
  602.     struct Window *SettingsWnd;
  603.  
  604.     V_BIGNUM ConX,ConY,ConW,ConH,NodeX,NodeY;
  605.  
  606.     // public:
  607.     V_BOOL SettingsOpen;
  608.     V_BOOL InformationOpen;
  609.  
  610.     // private:
  611.     char WindowTitle[90];
  612.  
  613.     // public: will be set to true if console window for node is open!
  614.     // so if it's not you can call HBBS_OpenWatchWindow()
  615.     V_BOOL ConOK;
  616.  
  617.  
  618.     // private:
  619.     V_BOOL SerOK;
  620.  
  621.  
  622.     // private: used by init/cleanup routines to determine wether to call CloseDevice()...
  623.     V_BOOL SerOPEN;
  624.  
  625.     // private:
  626.     char *ConBuffer;    // console data is read in here (most of the time!)
  627.     ULONG ConBufferLen; // actual memory allocated to the console buffer
  628.     ULONG ConBytes;     // bytes of data waiting in ConBuffer
  629.  
  630.     // private:
  631.     char *SerBuffer;    // same as above but for the serial port!
  632.     ULONG SerBufferLen;
  633.     ULONG SerBytes;
  634.  
  635.     // private:
  636.     char *IBuffer;      // InputBuffer is set to conbuffer or SerBuffer
  637.                         // according to where input came from
  638.     // private:
  639.     ULONG IBytes;       // set to the amount of bytes awaiting to be parsed
  640.                         // in the Input buffer
  641.  
  642.     // private:
  643.     V_BOOL SerWaiting;  // if these flags are set then it main that an IORequest
  644.     V_BOOL ConWaiting;  // has been sent, this must be aborted and waitio()'d
  645.                         // before closing, and must be checked before
  646.                         // you CheckIO() the request.. or CRASH!!! :-)
  647.  
  648.     // private: used for csi's!
  649.     char char1;
  650.  
  651.  
  652.     // private: used for csi's!
  653.     char csistring[256];
  654.  
  655.  
  656.     // private:
  657.     ULONG TimerSig,       // signals for input events..
  658.           SerSig,
  659.           InfoWinSig,
  660.           SettingsWinSig,
  661.           ConSig,
  662.           ConWinSig,
  663.           PortSig,
  664.           WinSig;
  665.  
  666.     // public:  after you call DOOR_GetLine() this will contain the string
  667.     // that was typed in..
  668.     V_STRING CurrentLine;
  669.  
  670.     // public:  after you call DOOR_GetLine() with a GL_LINEWRAG flag this may
  671.     // contain some data if the user was in the middle or writing a word
  672.     // see the LineEditor for an example of it's usage.
  673.     V_STRING CurrentLineWrap;
  674.  
  675.     // public: type of logon, (local, remote or none!)
  676.     V_BIGNUM LoginType; // defaults to LOGIN_NONE
  677.  
  678.  
  679.     // private:
  680.     ULONG NodeFlags;   // some flags..  NFLG_#?
  681.  
  682.  
  683.     // private:
  684.     V_BOOL RequestShutdown;
  685.  
  686.  
  687.     // public: actual path of the NODEx directory.
  688.     UBYTE *NodeLocation; // path setting, should be initialized by CONTROL
  689.                          // MUST and WILL always have a trailing : or / ....
  690.  
  691.  
  692.     // public: options from the device file
  693.  
  694.     struct DeviceData NodeDevice;
  695.  
  696.  
  697.     // public: the following options are defines in the nodeglobal or nodelocal files.
  698.  
  699.     struct NodeSettingsData NodeSettings;
  700.  
  701.  
  702.     // public: info about the user who's online...
  703.     // check N_ND->User.Valid before accessing any more data! in the NodeUser structure
  704.  
  705.     struct NodeUser User;
  706.  
  707.  
  708.     // private: Amount of doors the node program currently has spawned.
  709.     ULONG DoorsRunning;
  710.  
  711.  
  712.     // public: pointer to doordata structure of the active door, most if the time
  713.     // this will point to some door of somekind.
  714.  
  715.     struct DoorData *ActiveDoor; // WARNING: NULL if door is not running,
  716.                                  // for the name of door look at N_ND->ActiveDoor->node.ln_Name;
  717.  
  718.     // private: String returned by last active door.
  719.     UBYTE  DoorReturn[LEN_MAXDOORRETURN];
  720.  
  721.     // private: List of doors
  722.  
  723.     struct List *DoorList; // as a door has the ability to spawn another door using GoDoor()
  724.                            // we need to keep track of the loaded doors and the order in
  725.                            // which we ran them, so the door at the START of the list
  726.                            // (the lh_Head) if the active door (which was loaded last)
  727.                            // the one at the end of the list if the one we loaded first.
  728.                            // so we add new doors to the START of the list..
  729.                            // (quicker to parse than having the active door at the end of the list..)
  730.  
  731.     // public: pointer to conference that user is in, WARNING: might be NULL if
  732.     // user has not yet joined one..
  733.  
  734.     struct ConfData *CurrentConf;
  735.  
  736.     // private:
  737.     // when a user logs into a node the access settings for that users level are
  738.     // loaded here, DO NOT use these setting to check wether a user can access
  739.     // things tho, use N_ND->User.Acs[X]
  740.  
  741.     // *R* to be removed!!!
  742.     struct AccessData Acs;
  743.  
  744.  
  745.     // public:
  746.     UBYTE ConnectBaud[MAX_CPSBAUD_LEN+1];
  747.  
  748.     // public: used by WHO doors..
  749.     UBYTE Action[MAX_ACTION_LEN+1];
  750.  
  751.     V_BOOL TransferringFile;
  752.  
  753.     // public readable and door setable:  if a user is ONLINE (Via Local login or
  754.     // remote login then this will be set to OS_ONLINE.  Otherwise it will be set
  755.     // to OS_OFFLINE.  This variable is used by the node program to determine wether
  756.     // or not to continue running the next door in the sequnence or to reset the
  757.     // node...
  758.  
  759.     V_BOOL OnlineStatus;  // OS_ONLINE || OS_OFFLINE
  760.  
  761.     V_STRINGLIST Last_Callers;
  762.     V_STRINGLIST Last_Uploads;
  763.     V_STRINGLIST Last_Downloads;
  764.     V_STRINGLIST Last_Pagers;
  765.     V_STRINGLIST Last_PWFails;
  766.     V_STRINGLIST Last_Carrier;
  767.  
  768.     V_BIGNUM Max_Last_Callers,
  769.              Max_Last_Uploads,
  770.              Max_Last_Downloads,
  771.              Max_Last_Pagers,
  772.              Max_Last_PWFails,
  773.              Max_Last_Carrier;
  774.  
  775.     V_BIGNUM Current_Last_Callers,
  776.              Current_Last_Uploads,
  777.              Current_Last_Downloads,
  778.              Current_Last_Pagers,
  779.              Current_Last_PWFails,
  780.              Current_Last_Carrier;
  781.  
  782.     struct List *TaggedFileList; // list of struct TaggedFile's that is saved and
  783.                                  // reloaded, by the node program, when a user
  784.                                  // logs off and logs on respectivly
  785.     V_BIGNUM TaggedFiles; // number of tagged files (check when logging out ?)
  786.     V_SMALLNUM MaxDIZLines; // when a user is not in a conference then this is gained
  787.                             // from N_ND->NodeSettings.MaxDIZLines, otherwise it is
  788.                             // copied from N_ND->CurrentConf->MaxDIZLines
  789.     V_BOOL DoorContinue;
  790.  
  791.     V_BOOL AllowLogins;
  792.  
  793.     V_STRING CharsAllowed; // fill this with the characters you want the user to
  794.                            // be able to use when using DOOR_GetLine()
  795.                            // and specify GL_USECHARS as one of the flags
  796.                            // and when a user presses a key that's not in
  797.                            // this string a BEEP will be sent to their
  798.                            // system and the key will not be added to the currentline
  799.                            // (sort of like an edit hook, but not!)
  800.  
  801.     ULONG CallsToday; // saved in file: HBBS:System/Data/Misc.CFG as Node_X_Calls=
  802.  
  803.     struct List *OLMList;
  804.     V_BIGNUM OLMCount;     // also see NFLG_OLMSWAITING and "struct OLMNode"
  805.  
  806.     // private:
  807.     struct MsgPort *OLMPort;  // send a message to this port to make the bbs check
  808.                               // for OLM's!
  809.  
  810.     char Actions[LEN_ACTIONS+1]; // +1 for null terminator..
  811.                                // array of actions, check out the ACT_#? defines
  812.                                // in defines.h, basically it it set to a string
  813.                                // full of spaces upon node initialisation
  814.                                // and then actions are set if users run particular
  815.                                // types of door, this is SOOOOO handy for writing
  816.                                // lastcallers door,  this information is also
  817.                                // written to the callers log when a user logs off.
  818.     struct BBSColsData *BBSCols;
  819.                                // for setting colours of stuff like menu's etc..
  820.  
  821.     UBYTE LastCalledDate[LEN_DATESTR];
  822.     UBYTE LastCalledTime[LEN_TIMESTR];
  823.  
  824.     // *C* Move to NodeUser...
  825.  
  826.     V_BIGNUM FilesUploaded;
  827.     V_BIGNUM FilesDownloaded;
  828.     V_BIGNUM BytesUploaded;
  829.     V_BIGNUM BytesDownloaded;
  830.  
  831.   };
  832.  
  833. struct TaggedFile
  834.   {
  835.     struct Node node;  // ln_Name is the name of the file that's tagged
  836.     V_BIGNUM ConferenceNum; // the number of the conference that the file is in..
  837.     V_BIGNUM FileSize; // size of file (must be filled in or set to 0, this number
  838.                        // is used to determine if the user has enough creds to d/l and
  839.                        // will be added to thier bytes uploaded/downloaded total..
  840.     V_BOOL WarezFile; // if TRUE then bytes will be added to the ActualDownload#?
  841.                       // and Download#?, if false then bytes will only be added
  842.                       // to ActualDownload#?
  843.                       // (i.e. user does not loose creds if a non warez file..)
  844.  
  845.   };
  846.  
  847. // config files are read into memory and line by line are loaded into a linked
  848. // list of items and parameters, then to get a config option all we have to do
  849. // is search the linked list of items for a matching item name and return the params
  850. // in a desired format,  this works out much quicker than loading the config into mem
  851. // and parsing it everytime you want an option.. (which is how i did it to start with.
  852. // it's only when you try running it on a (lame) a500 that you realise how slow it
  853. // is to read in about 50-60 options when you start a node using the older method!
  854.  
  855. struct CfgItemData
  856.   {
  857.     struct Node node; // ln_name contains item name
  858.     UBYTE *Params;    // params contains the STRING of the parameter..
  859.   };
  860.  
  861. struct CfgFileData
  862.   {
  863.     struct List *ItemsList;
  864.     char *filename;
  865.   };
  866.  
  867. // because of the way HBBS data is stored in memory via linked varaibles *ANY*
  868. // program can access ALL DATA of the bbs and all of it's nodes at any time
  869. // just by getting a pointer to the following structure..
  870. // better than /X huh ? :-)
  871.  
  872. struct ProtocolNode
  873.   {
  874.     struct Node node;       // ln_Name is Protocol Name
  875.     V_BIGNUM protocoltype;  // PTYPE_BIDIRECTIONAL | PTYPE_UNIDIRECTIONAL
  876.     char *modulename;       // Name of door module to run
  877.     char *moduleopts;       // door options supplied to protocol module door
  878.     V_BOOL allow_ul;        // so you can specify a protocol is only availiable for
  879.     V_BOOL allow_dl;        // up load or download or both!
  880.     V_BOOL allow_batch;     // allow the transferring of more than one file at a time
  881.  
  882.   };
  883.  
  884. struct BBSGlobalData
  885.   {
  886.  
  887.     struct NodeData *NodeGlobalData;
  888.     struct List *NodeList;
  889.     struct MsgPort *CtrlMainPort,*CtrlMainReplyPort;
  890.     struct List *TimesList;
  891.     struct Screen *scr;
  892.  
  893.     // settings for bbs, all sturctures are sub structures of this..
  894.  
  895.     // public: linked list of all Conference Data (struct ConfData *)
  896.     struct List *ConfList; // list of conferences.
  897.  
  898.     // public: amount of conferences (active or not) (initialised by Control)
  899.     V_BIGNUM Conferences;
  900.  
  901.  
  902.     // public: linked list of TimeAcs's (struct TimeAccessData *)
  903.     struct List *TimeAcsList;
  904.  
  905.     // public: amount of TimeAcs's loaded
  906.     V_BIGNUM TimeAccesses;
  907.  
  908.     // public: list of access levels
  909.     V_STRINGLIST AcsLevelList;
  910.  
  911.     V_STRINGLIST AcsLevelNames;
  912.  
  913.     // public: amount of access levels
  914.     V_BIGNUM AcsLevels;
  915.  
  916.     // public readonly: amount of users in the user database.
  917.     V_BIGNUM TotalUsers;
  918.  
  919.     V_STRING ErrorLogFile;
  920.  
  921.     V_STRING BBSName;
  922.     V_BIGNUM BBSSerial;
  923.     V_STRING BBSLocation;
  924.     V_STRING BBSCountry;
  925.     V_STRINGLIST BBSGroup;
  926.  
  927.     V_BIGNUM BBSNodes;
  928.  
  929.     V_STRING SysopAccount; // the name of the sysop...
  930.  
  931.     V_STRINGLIST Drive;
  932.  
  933.     V_STRING BBSDrive;
  934.     V_BIGNUM MinFreeSpace;
  935.     V_STRING NoFreeSpaceScript;
  936.     V_STRINGLIST ButtonName;
  937.     V_STRINGLIST ButtonCMD;
  938.  
  939.     V_BOOL HideScreen;
  940.  
  941.     V_BIGNUM ScrModeID;
  942.     V_BIGNUM ScrWidth;
  943.     V_BIGNUM ScrHeight;
  944.     V_BIGNUM ScrDepth;
  945.  
  946.     V_STRING UserDataFileName;
  947.  
  948.     V_SMALLNUM NewUserAccessLevel;
  949.     V_SMALLNUM MaxUsernameAttempts;
  950.     V_SMALLNUM MaxPasswordAttempts;
  951.     V_SMALLNUM MinPasswordLength;
  952.  
  953.     V_BIGNUM NewUserConf;  // found in HBBS:Conferences/ConfList
  954.  
  955.     // readonly:  userid of the last user added to the system.
  956.     V_BIGNUM LastUserNum;
  957.  
  958.     V_STRINGLIST LanguageName;
  959.     V_STRINGLIST LanguageExtn;
  960.     V_BIGNUM Languages;
  961.  
  962.     struct List *ProtocolList;  // List of protocol information
  963.     int Protocols;              // Amount of protocols loaded
  964.  
  965.     V_STRING EditorCMD; // program to be used for editing text files!
  966.  
  967.     UBYTE LastCalledDate[LEN_DATESTR];
  968.     UBYTE LastCalledTime[LEN_TIMESTR];
  969.  
  970.     V_BIGNUM CallsToday; // saved in file: HBBS:System/Data/Misc.CFG
  971.                       // also sav Today=[datestr] in file
  972.     V_BIGNUM CopyBufferSize;
  973.  
  974.     V_BIGNUM CallsEver; // total amount of calls bbs has received!
  975.   };
  976.  
  977.  
  978. // an OLM door should check for the AccessLevel ACS_ALLOWOLM before a user is allowed
  979. // to send an OLM..  this is not part of HBBS_AddOLM() as you might want other
  980. // doors to send olm's (e.g. LogonAnnounce Doors..)
  981.  
  982. // (olm stands for OnLineMessage..)
  983.  
  984. struct OLMNode
  985. {
  986.   struct Node node;  // -> ln_Name contains the message, null terminated string, it *CAN* have \n's in it..
  987.                      // -> use node.ln_Pri to set an OLM's priority!!!
  988.                      // the higher the pri the nearer the top of the list
  989.  
  990.   UBYTE Handle[LEN_HANDLE+1]; // handle of the user who sent the olm
  991.                               // handle does not have to be valid,
  992.                               // but if you want to reply to an OLM
  993.                               // then you MUST check to see if it's valid...
  994.                               // reason: announce doors don't have handles :=)
  995.   UBYTE Time[LEN_TIMESTR];    // time olm was sent is added here..
  996.   UBYTE Date[LEN_DATESTR];    // date olm was sent is added here (in case it was sent at 11:59pm :-))
  997.  
  998.   UBYTE FromPRG[LEN_HANDLE+1]; // the name of the program that sent the door, note
  999.                                // the length constraints.
  1000.   V_SMALLNUM FromNode;        // 0, for external program, or a N_ND->NodeNum+1
  1001.  
  1002.  
  1003. };
  1004.